﻿Public Class frmFormaPago

    Dim ds As DataSet = Nothing

    Sub New(dt As DataSet)

        ' Llamada necesaria para el diseñador.
        InitializeComponent()

        ' Agregue cualquier inicialización después de la llamada a InitializeComponent().
        Me.ds = dt
    End Sub

    Private Sub frmFormaPago_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        cargarFormaPago()
    End Sub

    Sub cargarFormaPago()
        dgvForPagos.DataSource = ds.Tables(0)

        If ds.Tables(0).Rows.Count <> 0 Then
            dgvForPagos.Rows(0).Selected = False
        End If
    End Sub

    Private Sub dgvForPagos_CellClick(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvForPagos.CellClick
        Dim f As Integer = e.RowIndex

        If f > -1 Then
            frmMenu.formDocumento.txtFormaPago.Text = dgvForPagos.Item("Column1", f).Value.ToString.Trim
            'frmDocumento.lblFormaPago.Text = dgvForPagos.Item("Column2", f).Value.ToString.Trim
            'frmPedido.montoMinimo = CDec(dgvForPagos.Item("Column3", f).Value.ToString.Trim)
            'frmPedido.porcDsto = CDec(dgvForPagos.Item("Column4", f).Value.ToString.Trim)
            DialogResult = Windows.Forms.DialogResult.OK
        End If
    End Sub

End Class